#ifndef MYWIDGET_H
#define MYWIDGET_H

#include <QWidget>
#include <QModbusDataUnit>
#include <QModbusTcpClient>
#include <QModbusDevice>
#include <QString>

#include <QChartView>
#include <QLineSeries>

QT_CHARTS_USE_NAMESPACE

//class ModbusMaster;

class QModbusClient;
class QModbusReply;

namespace Ui {
class MyWidget;
}

class MyWidget : public QWidget
{
    Q_OBJECT

public:
    explicit MyWidget(QWidget *parent = 0);
    ~MyWidget();

    void CreatCharts();

    void CreatXMLTest();

    void WriteModbus(int addressName, quint16 strContent);


public slots:
    void readready();
    void query();

private slots:
    void on_clinckButton_clicked();

    void on_readButton_clicked();

    void on_comboBox_currentIndexChanged(int index);

    void on_cancelButton_clicked();

    void on_readXMLButton_clicked();

    void on_JGOpenButton_clicked();

    void on_JGCloseButton_clicked();

    void on_LXOpenButton_clicked();

    void on_LXCloseButton_clicked();

private:
    Ui::MyWidget *ui;
    //ModbusMaster *modbusMaster;

    QModbusTcpClient *client;
    int addressInt;
    QTimer *timer;

    QLineSeries *series1;
    QLineSeries *series3;
    QChart *chart1;
    QChartView *view1;
    int count;
    int MaxCount;
    QLineSeries *series2;
    QChart *chart2;
    QChartView *view2;


};

#endif // MYWIDGET_H
